<%@page contentType="text/html;charset=UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<c:choose >
	<c:when test="${sessionScope.currentUserId == null}">
		<c:if test="${requestScope.model.errorMessage != ''}">
			<label>${requestScope.model.errorMessage}</label>
		</c:if>
		<c:set var="defaultUserLogin" value="${requestScope.model.userLogin}"/>
		<c:if test="${requestScope.model.userLogin == null}">
			<c:set var="defaultUserLogin" value="Your NickName"/>
		</c:if>
		<c:set var="defaultUserPassword" value="${requestScope.model.userPassword}"/>
		<c:if test="${requestScope.model.userPassword == null}">
			<c:set var="defaultUserPassword" value="password"/>
		</c:if>
		<form name="login" method="post" action="<c:url value="main"/>">
		<input type="text" name="login" Id="login"  value="${defaultUserLogin}" onfocus="if(this.value == this.defaultValue) this.value = ''"/>
		<input type="text" name="password" id="password"  value="${defaultUserPassword}" onfocus="if(this.value == this.defaultValue) this.value = ''"/>
		<input type="submit" name="button" class="button" value="login"/>
		<label>want to be a member</label>
		<a href="<c:url value="registration"/>">resister now</a>
		</form>
	
	</c:when>
	<c:otherwise>
	    <div id="user_info">
		<p>Welcome back!</p>
		<span><c:out value="${requestScope.model.getCurrentUser().getUserNickName()}"/>	</span>	
		<a href="<c:url value="logoff"/>"><b>logoff<b/></a>
		</div>
	</c:otherwise>
</c:choose>
